﻿using AzureLogManager.Sample.TestClient.SampleService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AzureLogManager.Sample.TestClient
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public SampleServiceClient Client { get; set; }
        private String _result = "There's no feedback, check the log board to see results";
        private String _loading = "Loading...";

        public MainWindow()
        {
            InitializeComponent();

            this.Client = new SampleServiceClient();
        }

        private async void btHelloWorld_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtResult.Text = _loading;
                await this.Client.GetHelloWorldAsync();
                txtResult.Text = _result;
            }
            catch (Exception ex)
            {
                txtResult.Text = ex.ToString();
            }
        }

        private async void btException_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtResult.Text = _loading;
                await this.Client.GetNotImplementedExceptionAsync();
                txtResult.Text = _result;
            }
            catch (Exception ex)
            {
                txtResult.Text = ex.ToString();
            }
        }
    }
}
